home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cgazv5n5.arc / PROFINIT.C < prev    next >
Text File  |  1991-09-23  |  2KB  |  74 lines

  1. /*--- Listing 2 --------------------------- PROFINIT.C ----
  2.  * Author     : Mark Florence, San Francisco Canyon Co, Inc.
  3.  * History    : 01/27/91 Initial Implementation
  4.  * Compiler   : MS C6.00a (Large model)
  5.  *-------------------------------------------------------*/
  6.  
  7. // Includes
  8.  
  9.    #define INCL_DOS
  10.    #include <os2.h>
  11.  
  12.    #include "Profiler.h"
  13.  
  14.  
  15. // Global Variables
  16.  
  17.    int dummy;                   // Needed to fool MS C6.00a
  18.  
  19.  
  20. // Handle and Acknowledge Signals
  21.  
  22. VOID PASCAL FAR ProfilerSignalHandler (usSigArg, usSigNum)
  23.  
  24.       USHORT usSigArg;
  25.       USHORT usSigNum;
  26.  
  27.       // Handle and acknowledge signals
  28.  
  29. {     DosSetSigHandler (ProfilerSignalHandler, NULL, NULL,
  30.         SIGA_ACKNOWLEDGE, SIG_PFLG_A);
  31.       return;
  32. }
  33.  
  34.  
  35. // Terminate Profiler
  36.  
  37. VOID PASCAL FAR ProfilerTerminate (usTermCode)
  38.  
  39.       USHORT usTermCode;
  40.  
  41.    // Terminate Profiler signalling
  42.  
  43. {      DosSetSigHandler (ProfilerSignalHandler, NULL, NULL,
  44.         SIGA_KILL, SIG_PFLG_A);
  45.  
  46.    // Terminate exit list
  47.  
  48.       DosExitList (EXLST_EXIT, NULL);
  49.  
  50. }
  51.  
  52.  
  53. // Initialize Profiler
  54.  
  55. VOID EXPENTRY ProfilerInitialize (VOID)
  56.  
  57.    // Define function data
  58.  
  59. {     PIDINFO pidi;             // Process information
  60.  
  61.    // Get current process information
  62.  
  63.       DosGetPID (&pidi);
  64.  
  65.    // Start Profiler signalling
  66.  
  67.       DosSetSigHandler (ProfilerSignalHandler, NULL, NULL,
  68.         SIGA_ACCEPT, SIG_PFLG_A);
  69.  
  70.    // Define exit list
  71.  
  72.       DosExitList (EXLST_ADD, ProfilerTerminate);
  73.  
  74. }